package d1_reflect;

import java.util.Objects;

public class Student implements Comparable<Student>{
    @Override
    public int compareTo(Student o) {
        return this.age-o.age;//
    }

    private String name;
    private int age;
    private double height;

    public Student() {

    }

    public Student(String name, int age, double height) {
        this.name = name;
        this.age = age;
        this.height = height;
    }

    private void run(){
        System.out.println("100米跑进8秒");
    }

    private void eat(){
        System.out.println("爱吃大蒜");
    }

    private String eat(String name){
        return "爱吃"+name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return age == student.age && Double.compare(height, student.height) == 0 && Objects.equals(name, student.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age, height);
    }

    @Override
    public String toString() {
        return "student" + "="+name +","+ "age" + "="+ age +","+ "height" + "="+ height ;
    }
}
